<template>
  <div class="tag-chip" :key="index">
    <span class="label">{{ label }}</span>
    <span v-if="showRemove" class="remove-tag" @click.stop="emits('removeTag')"
      ><i class="fas fa-remove"></i
    ></span>
  </div>
</template>

<script setup>
const { label, index, showRemove } = defineProps({
  label: String,
  index: Number,
  showRemove: {
    type: Boolean,
    default: true,
  },
})
const emits = defineEmits(["removeTag"])
</script>

<style scoped>
.tag-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: var(--primary-light);
  color: var(--text);
  border-radius: 30px;
  font-size: 14px;
  transition: var(--transition);
}

.tag-chip:hover {
  transform: rotateY(30deg);
  cursor: pointer;
}

.tag-chip .label::before {
  content: "🔖";
}

.tag-chip .remove-tag {
  color: var(--primary-reverse);
  margin-left: 8px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}

.tag-chip .remove-tag:hover {
  transform: rotate(90deg);
  background: rgba(0, 0, 0, 0.2);
}
</style>
